package com.handle.system.svc.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.handle.system.api.dto.SysTenantDto;
import com.handle.system.api.entity.SysTenant;
import com.handle.system.api.service.ISysTenantService;
import com.handle.system.svc.convert.BeanCovert;
import com.handle.system.svc.mapper.SysTenantMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhangqing
 * @since 2021-06-01
 */
@Service
@AllArgsConstructor
public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant> implements ISysTenantService {

    private final SysTenantMapper sysTenantMapper;

    @Override
    public List<SysTenantDto> selectTenantByUser() {
        List<SysTenant> sysTenants = sysTenantMapper.selectList(Wrappers.emptyWrapper());
        return BeanCovert.INSTANCE.toTenantConvertDTOList(sysTenants);
    }
}
